<template>
  <basic-container class>
    <dataList :pageInfo="pager" placeholder="请输入物业名称" :listData="tableData" searchName="propertyName" :filterList="filterList" :menuList="[]">
      <el-table :data="tableData" style="width: 100%" align="left">
        <el-table-column label="物业名称" prop="propertyName" width="200" show-overflow-tooltip>
          <template slot-scope="scope">
            <span>{{scope.row.propertyName}}</span>
            <!-- <span class="property" @click="handleClickProperty(scope.row)">{{scope.row.propertyName}}</span> -->
          </template>
        </el-table-column>
        <el-table-column label="物业小类" :formatter="dictVal_propertyTypes" prop="projectType" width="100" />
        <el-table-column label="物业地址" prop="projectAddr" min-width="220" show-overflow-tooltip />
        <el-table-column label="具体位置" prop="address" width="100" show-overflow-tooltip />
        <el-table-column label="巡查人" prop="inspectionPerson" width="100" />
        <el-table-column label="实际巡查日期" prop="inspectionDate" width="120" />
        <el-table-column label="巡查结果" prop="inspectionResult" width="100">
          <template slot-scope="scope">
            <span :style="{color:(['1','4'].includes(scope.row.inspectionResult)?'red':'#000')}">{{inspectionResultFormatter(scope.row.inspectionResult)}}</span>
          </template>
        </el-table-column>
        <el-table-column label="管理所" prop="manageUnit" :formatter="manageFormatter" width="100" />
        <el-table-column label="备注" prop="remarks" width="150" show-overflow-tooltip />
        <el-table-column label="不通过原因" prop="reason" width="150" show-overflow-tooltip />
        <el-table-column width="80" label="操作" fixed="right">
          <template slot-scope="scope">
            <el-link type="primary" :underline="false" @click="showDetailsOfInspectionResults('view',scope.row)">查看</el-link>
          </template>
        </el-table-column>
      </el-table>
    </dataList>
    <el-dialog :title="title" custom-class="small-padding-dialog" :visible.sync="dialogTableVisible" :close-on-click-modal="false" width="80%" @close="close" class="basic-from">
      <div style="font-weight: 700; height: 40px; font-size: 16px;">基本信息</div>
      <el-form ref="resultDetailsForm" :model="resultDetailsForm" label-width="auto" class="form-wrap" style="padding-top:0px;" label-position="top">
        <el-form-item label="物业名称" prop="propertyName">
          <el-input v-halfCharCode v-model="resultDetailsForm.propertyName" readonly />
        </el-form-item>
        <el-form-item label="物业地址" prop="projectAddr">
          <el-input v-halfCharCode v-model="resultDetailsForm.projectAddr" readonly />
        </el-form-item>
        <el-form-item label="具体位置" prop="address">
          <el-input v-halfCharCode v-model="resultDetailsForm.address" readonly />
        </el-form-item>
        <el-form-item label="物业大类" prop="projectType">
          <span v-for="item in getDict('property_types')" :key="item.value">
            <el-input v-halfCharCode readonly v-if="resultDetailsForm.projectType == item.value" v-model="item.label" />
          </span>
        </el-form-item>
        <el-form-item label="物业小类" prop="projectSubclassType">
          <span v-for="item in getDict('property_use_types')" :key="item.value">
            <el-input v-halfCharCode readonly v-if="resultDetailsForm.projectSubclassType == item.value" v-model="item.label" />
          </span>
        </el-form-item>
        <el-form-item label="物业状态" prop="propertyStatus">
          <span v-for="item in getDict('room_status')" :key="item.value">
            <el-input v-halfCharCode readonly v-if="resultDetailsForm.propertyStatus == item.value" v-model="item.label" />
          </span>
        </el-form-item>
        <el-form-item label="使用单位" prop="useUnit">
          <el-input v-halfCharCode v-model="resultDetailsForm.useUnit" readonly />
        </el-form-item>
        <el-form-item label="联系电话" prop="mobile">
          <el-input v-halfCharCode v-model="resultDetailsForm.mobile" readonly />
        </el-form-item>
        <el-form-item label="预计巡查日期" prop="predictInspectionDate">
          <el-input v-halfCharCode v-model="resultDetailsForm.predictInspectionDate" readonly />
        </el-form-item>
        <el-form-item label="实际巡查日期" prop="inspectionDate">
          <el-input v-halfCharCode v-model="resultDetailsForm.inspectionDate" readonly />
        </el-form-item>
        <el-form-item label="所属管理所" prop="manageUnit">
          <span v-for="item in manageUnits" :key="item.value">
            <span v-if="resultDetailsForm.manageUnit == item.value">{{ item.label }}</span>
          </span>
        </el-form-item>
        <el-form-item label="巡查人员" prop="inspectionPerson">
          <el-input v-halfCharCode v-model="resultDetailsForm.inspectionPerson" readonly />
        </el-form-item>
        <el-form-item label="巡查参与人员" prop="inspectionOtherPerson">
          <el-input v-model="resultDetailsForm.inspectionOtherPerson" readonly />
        </el-form-item>
        <el-tabs v-model="tabTitle" class="full mb20">
          <el-tab-pane label="上报隐患记录" name="上报隐患记录">
            <el-table :data="resultDetailsForm.reportDangerRecord" :header-cell-style="{'text-align': ' center'}">
              <el-table-column property="inspectionName" align="left" label="检查项目" />
              <el-table-column property="inspectionStandard" align="left" label="检查标准" />
              <el-table-column property="inspectResult" align="center" label="检查结果">
                <template slot-scope="scope">
                  <span v-text="['2','3'].includes(scope.row.inspectResult) ? '达标': '未达标'"></span>
                </template>
              </el-table-column>
              <el-table-column property="substandardContents" align="left" label="补充说明">
                <template slot-scope="scope">
                  <el-input v-halfCharCode v-model="scope.row.substandardContents" readonly style="text-align: center;" />
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
        <el-form-item label="巡查结果：" prop="inspectionResult">
          <span :style="{color:(['1','4'].includes(resultDetailsForm.inspectionResult)?'red':'#000')}">{{inspectionResultFormatter(resultDetailsForm.inspectionResult)}}</span>
        </el-form-item>
        <el-form-item label="备注：" class="full">
          <el-input v-halfCharCode type="textarea" v-model="resultDetailsForm.remarks" readonly />
        </el-form-item>
        <h3 style="margin-top: 20px;" class="full">附件</h3>
        <el-divider class="full"></el-divider>
        <el-form-item v-if="dialogTableVisible" class="full">
          <v-upload hideExplain type="file" ref="upload" :busId="resultDetailsForm.resultId" modelType="checkin" v-model="uploadFileList" isShowFileList :isView="title === '查看巡查结果'" />
        </el-form-item>
        <h3 class="mt20 full">整改信息</h3>
        <el-divider class="full"></el-divider>
        <el-form-item label="整改意见：" class="full">
          <el-input class="full" v-model="resultDetailsForm.inspectionLogRectify.opinion" type="textarea" readonly maxlength="10" />
        </el-form-item>
        <el-form-item label="附件：" class="full">
          <div v-if="dialogTableVisible">
            <v-upload hideExplain type="file" ref="rectifyUpload" :busId="resultDetailsForm.inspectionLogRectify.inspectionLogId" modelType="rectify" v-model="rectifyFileList" autoLoadFiles isView />
          </div>
        </el-form-item>
      </el-form>
      <div>
        <h3>复查结果</h3>
        <el-divider></el-divider>
        <div class="reviewBox" v-for="(item,index) in resultDetailsForm.inspectionLogRecheck" :key="item.inspectionLogId" style="width:100%;border:1px solid #DCDFE6;">
          <p>复查人：{{item.approvePerson}}</p>
          <p>复查参与人员：{{item.inspectionOtherPerson}}</p>
          <p>复查时间：{{item.approveDate}}</p>
          <p>复查意见：{{item.opinion}}</p>
          <p>
            复查结果：
            <span :style="{color:(['1','4'].includes(item.inspectionResult)?'red':'#000')}">{{inspectionResultFormatter(item.inspectionResult)}}</span>
          </p>
          <p>
            附件：
            <v-upload type="file" hideExplain :busId="item.inspectionLogId" modelType="review" isView autoLoadFiles />
          </p>
        </div>
      </div>
      <span slot="footer">
        <el-button @click="dialogTableVisible = false">返回</el-button>
      </span>
    </el-dialog>
  </basic-container>
</template>
<script src="./index.js"></script>
<style lang="scss" scoped>
.fl {
  float: left;
}

.fr {
  float: right;
}
.footer {
  overflow: hidden;
}

.header {
  overflow: hidden;
  margin-bottom: 10px;

  .fl {
    width: 60%;
  }
}
.property {
  color: #1b68e8;
  cursor: pointer;
}
.reviewBox {
  padding: 15px;
  margin-bottom: 10px;
  p {
    line-height: 30px;
  }
}
</style>
